#define _CRT_SECURE_NO_WARNINGS 
#pragma once
#include"RBTree.h"

namespace vic
{
	template<class K,class V>
	class map
	{
		struct MapKeyOfT
		{
			const K& operator()(const pair<K,V>& kv)
			{
				return kv.first;
			}
		};
		
	public:
		typedef typename RBTree<K, pair<K, V>, MapKeyOfT>::iterator iterator;

		iterator begin()
		{
			return _t.begin();
		}
		iterator end()
		{
			return _t.end();
		}
		pair<iterator, bool> insert(const pair<K, V>& kv)
		{
			return _t.Insert(kv);
		}
		V& operator[](const K& key)
		{
			pair<iterator, bool> ret = insert(make_pair(K, V()));
			return ret.first->second;
		}
	private:
		RBTree<K, pair<K,V>, MapKeyOfT> _t;
	};




	void testmap1()
	{
		map<int,int> m;
		m.insert(make_pair(1,1));
		m.insert(make_pair(2,2));
		m.insert(make_pair(3,3));

	}

}